﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace TeamBuy.AccessService
{
    public static class TeamBuySystemInfo
    {
        private static DataTable dtSysInfo = TeamBuy.AccessService.AccessHelper.GetDataSet("select Top 1 * from S_SystemInfo");

        public static void ReloadSystemInfo()
        {
            dtSysInfo = TeamBuy.AccessService.AccessHelper.GetDataSet("select Top 1 * from S_SystemInfo");
        }

        public static string SiteName
        {
            get 
            {
                return dtSysInfo.Rows[0]["SiteName"].ToString();
            }
        }

        public static string SiteDomain
        {
            get
            {
                return dtSysInfo.Rows[0]["SiteDomain"].ToString();
            }
        }

        public static string ContactEmail
        {
            get
            {
                return dtSysInfo.Rows[0]["ContactEmail"].ToString();
            }
        }

        public static string BeianNumber
        {
            get
            {
                return dtSysInfo.Rows[0]["BeianNumber"].ToString();
            }
        }

        public static int DefaultCityID
        {
            get
            {
                return Convert.ToInt32(dtSysInfo.Rows[0]["DefaultCityID"]);
            }
        }

        public static string ActiveEmailAddress
        {
            get
            {
                return dtSysInfo.Rows[0]["ActiveEmailAddress"].ToString();
            }
        }

        public static string ActiveEmailSMTP
        {
            get
            {
                return dtSysInfo.Rows[0]["ActiveEmailSMTP"].ToString();
            }
        }

        public static string ActiveEmailPort
        {
            get
            {
                return dtSysInfo.Rows[0]["ActiveEmailPort"].ToString();
            }
        }

        public static string ActiveEmailPassword
        {
            get
            {
                return dtSysInfo.Rows[0]["ActiveEmailPassword"].ToString();
            }
        }

        public static bool IsNeedEmailActive
        {
            get
            {
                return Convert.ToBoolean(dtSysInfo.Rows[0]["IsNeedEmailActive"].ToString());
            }
        }

    }
}
